package br.ufc.custom.Graph;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;

import br.ufc.custom.multiHistogram.Cell;

public class Vertex implements Comparable<Vertex> {
	private Map<Vertex, Integer> neighbors;
	private int ID;
	private int weight;
	private Cell cell;

	public Vertex(int ID, int weight, Cell cell) {
		super();
		this.ID = ID;
		this.weight = weight;
		this.neighbors = new HashMap<Vertex, Integer>();
		this.cell = cell;
	}
	
	public void addNeighbor(Vertex v, int weight){
		neighbors.put(v, weight);
	}
	
	public Map<Vertex, Integer> getNeighbors() {
		return neighbors;
	}

	public int getID(){
		return this.ID;
	}
	
	public int getWeight() {
		return weight;
	}
	public void setPartition(int partition){
		cell.setPartition(partition);
	}

	@Override
	public int compareTo(Vertex v) {
		return v.getID() > this.getID() ? -1 : 1;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ID;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Vertex other = (Vertex) obj;
		if (ID != other.ID)
			return false;
		return true;
	}
	
}
